import Vue from 'vue'
// Vue.forceUpdate()
import App from './App'

// store
import store from './store'
Vue.prototype.$store = store;

// mixin
import global from '@/apiPost/mixin.js'
Vue.prototype.global = global;



// 数据接口
import httpApi from '@/apiPost/request.js'
const post = httpApi.post;
const upload = httpApi.upload;

// 上传接口
import uploadApi from '@/apiPost/uploadConfig.js'
const complaintApi = uploadApi.complaintApi

// 定义的方法
// import unit from '@/components/unit.js'
// Vue.prototype.$unit = unit;

Vue.prototype.$api = {
	post,
	// msg
	upload,
	complaintApi
};

import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom', cuCustom)

import goodspoor from './pages/goodspoor/index.vue'
Vue.component('goodspoor', goodspoor)

import backpack from './pages/goodspoor/backpack.vue'
Vue.component('backpack', backpack)

import myluck from './pages/goodspoor/user.vue'
Vue.component('myluck', myluck)

import socity from './pages/goodspoor/socity.vue'
Vue.component('socity', socity)

import kpindex from './pages/index/kpindex.vue'
Vue.component('kpindex', kpindex)

import market from './pages/market/index.vue'
Vue.component('market', market)

import tabbar from './pages/index/tabbar.vue'
Vue.component('tabbar', tabbar)

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
	...App
})

import uView from '@/uni_modules/uview-ui'
Vue.use(uView)

// 引入uView对小程序分享的mixin封装
let mpShare = require('@/uni_modules/uview-ui/libs/mixin/mpShare.js');
Vue.mixin(mpShare)


app.$mount()
import globals from 'utils/util.js'
Vue.prototype.$globals = globals;

//欧气一番 小程序tag
Vue.prototype.$mpVer = "v3"
// pro v4
// ultra v3

const trylogin = (i) => {
	uni.navigateTo({
		url: `/pages/login/login?name=` + i
	})
	return
	/*uni.reLaunch({
		url: `/pages/login/login`
	});*/
}


// 加密
const mdnum = () => {
	let num = ''
	for (var i = 0; i < 5; i++) {
		let d = uni.$u.random(0, 9)
		num = num + d
	}

	const date = (new Date().getTime() / 1000).toFixed(0);
	var str = date + 'akd!k123#dfg' + num
	var arr = new Array(date, str, num);
	return arr;
}

Vue.prototype.$uniApi = {
	trylogin,
	mdnum
};
import webSocketClass from 'utils/websocketStore.js'
Vue.prototype.$websocket = webSocketClass